home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Source Code / C / Frameworks / Grant's CGI Framework 1.0b14 / Util / DebugUtil.c < prev    next >
Text File  |  1996-04-10  |  1KB  |  58 lines

  1. /*****
  2.  *
  3.  *    DebugUtil.c
  4.  *
  5.  *    For those of you unfamilliar with assertions, run - don't walk -
  6.  *    to get a copy of "Code Complete" by Steve McDonnell(sp?)
  7.  *
  8.  *    This is a support file for "Grant's CGI Framework".
  9.  *    Please see the license agreement that accompanies the distribution package
  10.  *    for licensing details.
  11.  *
  12.  *    Copyright ©1995,1996 by Grant Neufeld
  13.  *    grant@acm.com
  14.  *    http://arpp.carleton.ca/grant/
  15.  *
  16.  *****/
  17.  
  18. #include <ConditionalMacros.h>
  19.  
  20. #include "MyConfiguration.h"
  21.  
  22. #include "compiler_stuff.h"
  23.  
  24. #include "LogUtil.h"
  25.  
  26. #include "DebugUtil.h"
  27.  
  28.  
  29. /***  FUNCTIONS  ***/
  30.  
  31. /* if the assertion (passed) fails, display the string in the debugger to alert
  32.     the developer to an unexpected problem in the code.
  33.     theString must be a Pascal format string (IE. "\p").
  34.     If an assertion ever occurs, you know that one of two things has occurred:
  35.     - something you never expected to happen in your function, happened
  36.     - you made an incorrect assumption about what state things could be in
  37.         prior to your function being called */
  38. #if kCompileWithAssertions
  39. p_export
  40. void
  41. my_assert ( Boolean passed, const StringPtr theString )
  42. {
  43.     if ( !passed )
  44.     {
  45.         LogStringDebugP ( theString );
  46.         
  47.         #if GENERATINGPOWERPC
  48.         DebugStr ( theString );
  49.         #else
  50.         SysBreakStr ( theString );
  51.         #endif
  52.     }
  53. } /* my_assert */
  54. #endif
  55.  
  56.  
  57. /***  EOF  ***/
  58.